1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using System.IO;
10
11 namespace Best_Notepad
12 {
13 public partial class notepad1 : Form
14 {
15 //left side pr + - krny k lye hoti ha
16 #region fields
17 //ye 3 viriable save k lye lye ha
18 private bool isFileAlreadySave;
19 private bool isFileDirty;
20 private string currentOpenFileName;
21 private FontDialog fontdialog = new FontDialog(); //format ma fontcolor ko apply krny k lye
22 #endregion
23
24 public notepad1()
25 {
26 InitializeComponent();
27 }
28 //3 br / / / ko ak sath likhny sy ye comments aty ha
29 /// <summary>
30 /// About Notepad with Hassan Malik ka all code ha nichy
31 /// </summary>
32 /// <param name="sender"></param>
33 /// <param name="e"></param>
34
35 private void toolStripMenuItem2_Click(object sender, EventArgs e)
36 {
37
38 }
39
40
41 /// <summary>
42 /// about notepad innformation
43 /// </summary>
44 /// <param name="sender"></param>
45 /// <param name="e"></param>
46 private void aboutNotepadToolStripMenuItem_Click(object sender, EventArgs e)
47 {
48 MessageBox.Show("All Right Reserved with Hassan ", "About Notepad", MessageBoxButtons.OK, MessageBoxIcon.Information);
49 }
50
51
52
53 /// <summary>
54 /// New file open code
55 /// </summary>
56 /// <param name="sender"></param>
57 /// <param name="e"></param>
58 private void newToolStripMenuItem_Click(object sender, EventArgs e)
59 {
60 newFileMaMethod();
61 }
62
63 private void newFileMaMethod()
64 {
65 //mainrichTextBox.Clear();
66 //agr new p clilck kry to ye msg ay
67 if (isFileDirty)
68 {
69
70
71 DialogResult result = MessageBox.Show("Do you want to save changes ? ", "File Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
72 //yes no k lye code
73 switch (result)
74 {
75
76 case DialogResult.Yes:
77 savefilemanu();
78 break;
79
80 case DialogResult.No:
81
82 break;
83 case DialogResult.Cancel:
84 MessageBox.Show("Develop by Hassan Malik ","Go to New File", MessageBoxButtons.OK);
85 //undoKlyeMethod();
86 break;
87
88 }
89
90 }
91
92 //mehod ha ye right click kr k iski defination ma ja k dekh skty ha
93 clearScreen(); //agr file ma kch ni ha to clearscreen ka jo khudsy method bnaya ha wo chly
94
95 //ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
96 isFileAlreadySave = false;
97 currentOpenFileName = "";
98
99 EnableDisableUndoRedoProcessKaMethog(false);
100
101 messagetoolStripStatusLabel.Text = "New Document is Created ";
102
103 }
104
105
106 /// <summary>
107 /// exit application code
108 /// </summary>
109 /// <param name="sender"></param>
110 /// <param name="e"></param>
111 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
112 {
113 Application.Exit();
114 }
115
116
117
118
119
120 /// <summary>
121 /// open file code
122 /// </summary>
123 /// <param name="sender"></param>
124 /// <param name="e"></param>
125
126 private void openToolStripMenuItem_Click(object sender, EventArgs e)
127 {
128 OpenKlyeMethod();
129 }
130
131 private void OpenKlyeMethod()
132 {
133 //kse b file ko open krny k lye
134 OpenFileDialog openfiledialog = new OpenFileDialog();
135 openfiledialog.Filter = "Text Files (*.txt)|*.txt|Rich Text Format (*.rtf)|*.rtf|MSWord Files (*.docx)|*.docx|PHP (*.php)|*.php";
136
137 DialogResult result = openfiledialog.ShowDialog();
138
139 if (result == DialogResult.OK)
140 {
141 if (Path.GetExtension(openfiledialog.FileName) == ".txt")
142
143 mainrichTextBox.LoadFile(openfiledialog.FileName, RichTextBoxStreamType.PlainText);
144
145 //php ki file add krny k lye phly uper likhna pryga fr nichy ye 2 lines if condition k andr
146 if (Path.GetExtension(openfiledialog.FileName) == ".php")
147 mainrichTextBox.LoadFile(openfiledialog.FileName, RichTextBoxStreamType.PlainText);
148
149
150
151 if (Path.GetExtension(openfiledialog.FileName) == ".rtf")
152 mainrichTextBox.LoadFile(openfiledialog.FileName, RichTextBoxStreamType.RichText);
153
154 this.Text = Path.GetFileName(openfiledialog.FileName) + " - Notepad with Hassan Malik"; //file ka caption ma name dna jo b open kry
155 //koi b file open kry to uska name b ajay
156
157 //ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
158 isFileAlreadySave = true;
159 isFileDirty = false;
160 currentOpenFileName = openfiledialog.FileName;
161
162 EnableDisableUndoRedoProcessKaMethog(false);
163
164 messagetoolStripStatusLabel.Text = " File is Opened !";
165
166 }
167
168 }
169
170 /// <summary>
171 /// undo r redo k lye ak method bnaya ha
172 /// </summary>
173 /// <param name="enable"></param>
174 private void EnableDisableUndoRedoProcessKaMethog(bool enable)
175 {
176 undoToolStripMenuItem.Enabled = enable;
177 redoToolStripMenuItem.Enabled = enable;
178 }
179
180
181
182 /// <summary>
183 /// saveAs file code
184 /// </summary>
185 /// <param name="sender"></param>
186 /// <param name="e"></param>
187 private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
188 {//save file code Call Method
189 SaveAsFileKaMethod();
190
191 }
192
193 private void SaveAsFileKaMethod()
194 {
195 SaveFileDialog savefiledialog = new SaveFileDialog();
196 savefiledialog.Filter = "Text Files (*.txt)|*.txt|Rich Text Format (*.rtf)|*.rtf|MSWord Files (*.docx)|*.docx|PHP (*.php)|*.php";
197 DialogResult result = savefiledialog.ShowDialog();
198 if (result == DialogResult.OK)
199 {
200 if (Path.GetExtension(savefiledialog.FileName) == ".txt")
201 mainrichTextBox.SaveFile(savefiledialog.FileName, RichTextBoxStreamType.PlainText);
202
203
204 if (Path.GetExtension(savefiledialog.FileName) == ".php")
205 mainrichTextBox.SaveFile(savefiledialog.FileName, RichTextBoxStreamType.PlainText);
206
207
208 if (Path.GetExtension(savefiledialog.FileName) == ".rtf")
209 mainrichTextBox.SaveFile(savefiledialog.FileName, RichTextBoxStreamType.RichText);
210
211
212 this.Text = Path.GetFileName(savefiledialog.FileName) + " -Notepad with Hassan Malik";
213
214 //ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
215 isFileAlreadySave = true;
216 isFileDirty = false;
217 currentOpenFileName = savefiledialog.FileName;
218
219 }
220 }
221
222
223
224
225 /// <summary>
226 /// save file code
227 /// </summary>
228 /// <param name="sender"></param>
229 /// <param name="e"></param>
230 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
231 {//save file code method call
232 savefilemanu();
233 }
234
235 private void savefilemanu()
236 {
237 if (isFileAlreadySave)//agr file phly he save ha to
238 {
239 //ismy sirf currentOpenFileName iska izafa kia ha baki porana code ha jo oper likha hooa ha
240
241 if (Path.GetExtension(currentOpenFileName) == ".txt")
242 mainrichTextBox.SaveFile(currentOpenFileName, RichTextBoxStreamType.PlainText);
243
244
245 if (Path.GetExtension(currentOpenFileName) == ".php")
246 mainrichTextBox.SaveFile(currentOpenFileName, RichTextBoxStreamType.PlainText);
247
248
249 if (Path.GetExtension(currentOpenFileName) == ".rtf")
250 mainrichTextBox.SaveFile(currentOpenFileName, RichTextBoxStreamType.RichText);
251 // this.Text = Path.GetFileName() + " -Notepad with Hassan Malik";
252 isFileDirty = false;
253 }
254 else
255 {
256
257 if (isFileDirty)
258 {
259 //right click kr k iski defination ko check kr skty ha
260 SaveAsFileKaMethod();
261
262 }
263
264 else
265 {
266
267 clearScreen();
268
269
270 }
271
272 }
273 }
274
275
276
277 /// <summary>
278 /// clearscreen code
279 /// </summary>
280 private void clearScreen()
281 {
282 mainrichTextBox.Clear(); //phly clear kry dr nichy wala txt ko string m araha ha wo dikhay
283 this.Text = "Untitled - Notepad with Hassan Malik";
284 isFileDirty = false;
285 }
286
287
288 /// <summary>
289 /// jb is application ko run kia jay to ye start ma null ho
290 /// </summary>
291 /// <param name="sender"></param>
292 /// <param name="e"></param>
293 private void Form1_Load(object sender, EventArgs e)
294 {
295 messagetoolStripStatusLabel.Text = " Normal Text File.. ";
296 //ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
297 isFileAlreadySave = false;
298 isFileDirty = false;
299 currentOpenFileName = "";
300
301 //YE WO NICHY JO CAPS HA USKY LYE HA
302
303 if (Control.IsKeyLocked(Keys.CapsLock))
304 {
305 capstoolStripStatusLabel.Text = " Caps ON";
306 }
307 else
308 {
309 capstoolStripStatusLabel.Text = " Caps OFF";
310 }
311
312 }
313
314
315
316
317
318 /// <summary>
319 /// mainrichtextbox k lye ha ye
320 /// </summary>
321 /// <param name="sender"></param>
322 /// <param name="e"></param>
323 private void mainrichTextBox_TextChanged(object sender, EventArgs e)
324 {
325 isFileDirty = true; // k file ma kch ha
326 undoToolStripMenuItem.Enabled = true; // jb ye ho to undo nzr ay wrna usko disable kia ta design ma left click kr k enable ko disable ki ta
327
328 toolStripButton7.Enabled = true;
329 //ye refresh klye ha
330 undoToolStripMenuItem1.Enabled = true;
331 }
332
333
334 /// <summary>
335 /// undo k lye ye code ha k phly mainrichtextbox.undo() ka method call ho r
336 /// usky bad redo ka option true hojay yni nzr ay r undo disable hojay
337 /// </summary>
338 /// <param name="sender"></param>
339 /// <param name="e"></param>
340 private void undoToolStripMenuItem_Click(object sender, EventArgs e)
341 {
342 undoKlyeMethod();
343 }
344
345 private void undoKlyeMethod()
346 {
347
348 mainrichTextBox.Undo();
349 redoToolStripMenuItem.Enabled = true;
350 toolStripButton8.Enabled = true;
351 toolStripButton7.Enabled = false;
352
353 //yr refresh wali jga jo hoty ha usky llye
354 undoToolStripMenuItem1.Enabled = false;
355 redoToolStripMenuItem1.Enabled = true;
356
357 undoToolStripMenuItem.Enabled = false;
358 //jb ye undo ho tb redo b enable hojay
359 }
360 /// <summary>
361 /// ye undo ka opposite ha
362 /// </summary>
363 /// <param name="sender"></param>
364 /// <param name="e"></param>
365
366 private void redoToolStripMenuItem_Click(object sender, EventArgs e)
367 {
368 redoKlyemethod();
369 }
370
371 private void redoKlyemethod()
372 {
373 mainrichTextBox.Redo();
374 redoToolStripMenuItem.Enabled = false;
375 toolStripButton8.Enabled = false;
376 toolStripButton7.Enabled = true;
377
378 //yr refresh wali jga jo hoty ha usky llye
379 undoToolStripMenuItem1.Enabled = true;
380 redoToolStripMenuItem1.Enabled = false;
381
382 undoToolStripMenuItem.Enabled = true;
383 }
384
385 //label pr apni website ka link dia ha
386 private void label2_Click(object sender, EventArgs e)
387 {
388
389 }
390
391
392 /// <summary>
393 /// login k name sy ak form bnaya ha usko yna object k zrye call kia ha
394 /// ye agr chlta ha to login page close ho k form1 wala page run hojay
395 /// r jb wo login wala page run hoga singnout agr krty ha to fr
396 /// login wala page close hojayga
397 /// q k ye main page ha main page hide hota ha r andr wala page close
398 /// </summary>
399 /// <param name="sender"></param>
400 /// <param name="e"></param>
401 private void signOutToolStripMenuItem1_Click(object sender, EventArgs e)
402 {
403 this.Hide();
404 Login obj = new Login();
405 obj.Show();
406 }
407
408
409
410 /// <summary>
411 /// selectall ka code
412 /// </summary>
413 /// <param name="sender"></param>
414 /// <param name="e"></param>
415
416 private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
417 {
418 //select all easy ha ak he line ka code ha
419
420 mainrichTextBox.SelectAll();
421 }
422
423
424 /// <summary>
425 /// date time k lye code
426 /// </summary>
427 /// <param name="sender"></param>
428 /// <param name="e"></param>
429
430 private void dateToolStripMenuItem_Click(object sender, EventArgs e)
431 {
432 //date time b ak he line ka code ha
433
434 mainrichTextBox.SelectedText = DateTime.Now.ToString();
435
436 }
437
438
439
440 //font ka kam strt hogya
441 private void boldToolStripMenuItem_Click(object sender, EventArgs e)
442 {
443 FontKlyeMethod(FontStyle.Bold);
444 // mainrichTextBox.SelectionFont = new Font(mainrichTextBox.Font, FontStyle.Bold);
445 }
446
447 private void italicToolStripMenuItem_Click(object sender, EventArgs e)
448 {
449 //font style k lye ha ye ak ak line ma ak chz ho rhe ha jsy ye bold ka code ha
450 FontKlyeMethod(FontStyle.Italic);
451 }
452 //method bnaya ha font ka
453 private void FontKlyeMethod(FontStyle fontstyleVeriable)
454 {
455
456 mainrichTextBox.SelectionFont = new Font(mainrichTextBox.SelectionFont, fontstyleVeriable);
457 }
458
459 private void underlineToolStripMenuItem_Click(object sender, EventArgs e)
460 {
461 FontKlyeMethod(FontStyle.Underline);
462 // mainrichTextBox.SelectionFont = new Font(mainrichTextBox.SelectionFont, FontStyle.Underline);
463 }
464
465 private void strikethroughToolStripMenuItem_Click(object sender, EventArgs e)
466 {
467 FontKlyeMethod(FontStyle.Strikeout);
468 // mainrichTextBox.SelectionFont = new Font(mainrichTextBox.SelectionFont, FontStyle.Strikeout);
469 }
470
471 private void normatToolStripMenuItem_Click(object sender, EventArgs e)
472 {
473 FontKlyeMethod(FontStyle.Regular);
474 }
475
476
477 /// <summary>
478 /// format font k lye code instance veriable ma ak r chz private kr k dalni pryge
479 /// ak event k lye b programmming krni ha ismy/// </summary>
480 /// <param name="sender"></param>
481 /// <param name="e"></param>
482 private void formatFontToolStripMenuItem_Click(object sender, EventArgs e)
483 {
484 fontKlyeMethod();
485 }
486
487 private void fontKlyeMethod()
488 {
489 // FontDialog fontdialog = new FontDialog() {
490 fontdialog.ShowColor = true;
491 fontdialog.ShowApply = true;
492
493 fontdialog.Apply += new System.EventHandler(fontdialog_apply);
494
495 // };
496 // fontdialog.ShowColor = true;
497
498 DialogResult result = fontdialog.ShowDialog(); //ye dialogresult khudsy agr na likha jay to uper sy copy krlyn
499
500 if (result == DialogResult.OK)
501 {
502 if (mainrichTextBox.SelectionLength > 0)
503 {
504 mainrichTextBox.SelectionFont = fontdialog.Font;
505 mainrichTextBox.SelectionColor = fontdialog.Color;
506 }
507 else
508 {
509 //MessageBox.Show("please select first");
510 }
511 }
512 else
513 {
514
515
516 }
517
518 }
519
520 private void fontdialog_apply(object sender, EventArgs e) {
521
522 if (mainrichTextBox.SelectionLength > 0)
523 {
524 mainrichTextBox.SelectionFont = fontdialog.Font;
525 mainrichTextBox.SelectionColor = fontdialog.Color;
526 }
527
528 }
529
530
531
532
533
534
535
536
537
538 /// <summary>
539 /// text ka color change krny k lye code
540 /// ye dialogresult k lye mne uper sy dialogresult ko cupy kia hoa h
541 /// uper yni isi page ma uper sy na k khe r sy
542 /// </summary>
543 /// <param name="sender"></param>
544 /// <param name="e"></param>
545 private void changeTextColorToolStripMenuItem_Click(object sender, EventArgs e)
546 {
547 ColorDialog colordialog = new ColorDialog();
548 DialogResult result = colordialog.ShowDialog();
549
550 if (result == DialogResult.OK)
551 {
552
553 if (mainrichTextBox.SelectionLength > 0)
554 {
555
556 mainrichTextBox.SelectionColor = colordialog.Color;
557
558 }
559
560 }
561
562 }
563
564 private void newtoolStripButton_Click(object sender, EventArgs e)
565 {
566 newFileMaMethod();
567 // messagetoolStripStatusLabel.Text = "New Click.. ";
568
569 }
570
571 private void toolStripButton2_Click(object sender, EventArgs e)
572 {
573 OpenKlyeMethod();
574 //messagetoolStripStatusLabel.Text = "Open Click.. ";
575 }
576
577 private void toolStripButton3_Click(object sender, EventArgs e)
578 {
579 //save file code method call
580 savefilemanu();
581 }
582
583 private void toolStripButton4_Click(object sender, EventArgs e)
584 {
585 //save file code Call Method
586 SaveAsFileKaMethod();
587 }
588
589 private void toolStripButton7_Click(object sender, EventArgs e)
590 {
591 undoKlyeMethod();
592 }
593
594 private void toolStripButton8_Click(object sender, EventArgs e)
595 {
596 redoKlyemethod();
597 }
598
599 private void toolStripButton9_Click(object sender, EventArgs e)
600 {
601
602 FontKlyeMethod(FontStyle.Bold);
603 }
604
605 private void toolStripButton10_Click(object sender, EventArgs e)
606 {
607 FontKlyeMethod(FontStyle.Italic);
608 }
609
610 private void toolStripButton11_Click(object sender, EventArgs e)
611 {
612 FontKlyeMethod(FontStyle.Underline);
613 }
614
615 private void toolStripButton12_Click(object sender, EventArgs e)
616 {
617 FontKlyeMethod(FontStyle.Strikeout);
618 }
619
620 private void toolStripButton12_Click_1(object sender, EventArgs e)
621 {
622 FontKlyeMethod(FontStyle.Strikeout);
623 }
624
625 private void toolStripButton13_Click(object sender, EventArgs e)
626 {
627 fontKlyeMethod();
628 }
629
630 private void mainrichTextBox_KeyDown(object sender, KeyEventArgs e)
631 {
632 if (Control.IsKeyLocked(Keys.CapsLock))
633 {
634 capstoolStripStatusLabel.Text = " Caps ON";
635 }
636 else
637 {
638 capstoolStripStatusLabel.Text = " Caps OFF";
639 }
640
641 }
642
643 private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
644 {
645
646 Refresh();
647
648
649 }
650
651 private void boldToolStripMenuItem1_Click(object sender, EventArgs e)
652 {
653
654 FontKlyeMethod(FontStyle.Bold);
655 }
656
657 private void italicToolStripMenuItem1_Click(object sender, EventArgs e)
658 {
659 FontKlyeMethod(FontStyle.Italic);
660 }
661
662 private void underlineToolStripMenuItem1_Click(object sender, EventArgs e)
663 {
664 FontKlyeMethod(FontStyle.Underline);
665 }
666
667 private void normalToolStripMenuItem_Click(object sender, EventArgs e)
668 {
669 FontKlyeMethod(FontStyle.Regular);
670 }
671
672 private void undoToolStripMenuItem1_Click(object sender, EventArgs e)
673 {
674 undoKlyeMethod();
675 }
676
677 private void redoToolStripMenuItem1_Click(object sender, EventArgs e)
678 {
679
680 redoKlyemethod();
681 }
682
683 private void fileToolStripMenuItem_Click(object sender, EventArgs e)
684 {
685
686 }
687
688 private void toolStripStatusLabel1_Click(object sender, EventArgs e)
689 {
690 System.Diagnostics.Process.Start("https://allice9554.000webhostapp.com/");
691 }
692
693 private void cutToolStripMenuItem_Click(object sender, EventArgs e)
694 {
695 if (mainrichTextBox.SelectionLength > 0)
696 {
697
698
699 Clipboard.SetText(mainrichTextBox.SelectedText);
700 mainrichTextBox.SelectedText = "";
701
702 }
703 //if(mainrichTextBox.SelectionLength >0)
704 // mainrichTextBox.Cut();
705 }
706
707 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
708 {
709 if (mainrichTextBox.SelectionLength > 0)
710 mainrichTextBox.Copy();
711 }
712
713 private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
714 {
715 if (Clipboard.ContainsText())
716 {
717 mainrichTextBox.SelectedText = Clipboard.GetText();
718 }
719 // mainrichTextBox.Paste();
720 }
721
722 private void cutToolStripMenuItem1_Click(object sender, EventArgs e)
723 {
724 if (mainrichTextBox.SelectionLength > 0)
725 {
726
727
728 Clipboard.SetText(mainrichTextBox.SelectedText);
729 mainrichTextBox.SelectedText = "";
730
731 }
732 //mainrichTextBox.Cut();
733 }
734
735 private void copyToolStripMenuItem1_Click(object sender, EventArgs e)
736 {
737 if (mainrichTextBox.SelectionLength > 0)
738 mainrichTextBox.Copy();
739 }
740
741 private void pasteToolStripMenuItem1_Click(object sender, EventArgs e)
742 {
743 if (Clipboard.ContainsText())
744 {
745 mainrichTextBox.SelectedText = Clipboard.GetText();
746 }
747 // mainrichTextBox.Paste();
748 }
749
750 private void toolStripButton14_Click(object sender, EventArgs e)
751 {
752 if (mainrichTextBox.SelectionLength > 0)
753 {
754
755
756 Clipboard.SetText(mainrichTextBox.SelectedText);
757 mainrichTextBox.SelectedText = "";
758
759 }
760 //mainrichTextBox.Cut();
761 }
762
763 private void toolStripButton15_Click(object sender, EventArgs e)
764 {
765 if (mainrichTextBox.SelectionLength > 0)
766 mainrichTextBox.Copy();
767 }
768
769 private void toolStripButton1_Click(object sender, EventArgs e)
770 {
771 if (Clipboard.ContainsText())
772 {
773 mainrichTextBox.SelectedText = Clipboard.GetText();
774 }
775 //mainrichTextBox.Paste();
776 }
777
778 private void speachToolStripMenuItem_Click(object sender, EventArgs e)
779 {
780 //this.Hide();
781 SpeechForm sp = new SpeechForm();
782 sp.Show();
783 }
784
785 private void toolStripButton16_Click(object sender, EventArgs e)
786 {
787 //this.Hide();
788 SpeechForm sp = new SpeechForm();
789 sp.Show();
790 // if()
791 messagetoolStripStatusLabel.Text = "SpeechBOx Start.. ";
792 }
793
794 private void speechToolStripMenuItem_Click(object sender, EventArgs e)
795 {
796
797 }
798
799 private void messagetoolStripStatusLabel_Click(object sender, EventArgs e)
800 {
801
802 }
803
804 private void fileToolStripMenuItem_MouseHover(object sender, EventArgs e)
805 {
806 //messagetoolStripStatusLabel.Text = " Start.. ";
807 }
808
809 private void calculatorToolStripMenuItem_Click(object sender, EventArgs e)
810 {
811 //this.Hide();
812 //SecondCalculator.mainForm m = new SecondCalculator.mainForm();
813 //m.ShowDialog();
814 }
815 }
816 }
left side pr + - krny k lye hoti ha
ye 3 viriable save k lye lye ha
private FontDialog fontdialog = new FontDialog(); format ma fontcolor ko apply krny k lye
3 br ko ak sath likhny sy ye comments aty ha
About Notepad with Hassan Malik ka all code ha nichy
about notepad innformation
New file open code
mainrichTextBox.Clear();
agr new p clilck kry to ye msg ay
yes no k lye code
undoKlyeMethod();
mehod ha ye right click kr k iski defination ma ja k dekh skty ha
clearScreen(); agr file ma kch ni ha to clearscreen ka jo khudsy method bnaya ha wo chly
ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
exit application code
open file code
kse b file ko open krny k lye
php ki file add krny k lye phly uper likhna pryga fr nichy ye 2 lines if condition k andr
this.Text = Path.GetFileName(openfiledialog.FileName) + " - Notepad with Hassan Malik"; file ka caption ma name dna jo b open kry
koi b file open kry to uska name b ajay
ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
undo r redo k lye ak method bnaya ha
saveAs file code
{save file code Call Method
ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
save file code
{save file code method call
if (isFileAlreadySave)agr file phly he save ha to
ismy sirf currentOpenFileName iska izafa kia ha baki porana code ha jo oper likha hooa ha
this.Text = Path.GetFileName() + " -Notepad with Hassan Malik";
right click kr k iski defination ko check kr skty ha
clearscreen code
mainrichTextBox.Clear(); phly clear kry dr nichy wala txt ko string m araha ha wo dikhay
jb is application ko run kia jay to ye start ma null ho
ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
YE WO NICHY JO CAPS HA USKY LYE HA
mainrichtextbox k lye ha ye
isFileDirty = true; k file ma kch ha
undoToolStripMenuItem.Enabled = true; jb ye ho to undo nzr ay wrna usko disable kia ta design ma left click kr k enable ko disable ki ta
ye refresh klye ha
undo k lye ye code ha k phly mainrichtextbox.undo() ka method call ho r
usky bad redo ka option true hojay yni nzr ay r undo disable hojay
yr refresh wali jga jo hoty ha usky llye
jb ye undo ho tb redo b enable hojay
ye undo ka opposite ha
yr refresh wali jga jo hoty ha usky llye
label pr apni website ka link dia ha
login k name sy ak form bnaya ha usko yna object k zrye call kia ha
ye agr chlta ha to login page close ho k form1 wala page run hojay
r jb wo login wala page run hoga singnout agr krty ha to fr
login wala page close hojayga
q k ye main page ha main page hide hota ha r andr wala page close
selectall ka code
select all easy ha ak he line ka code ha
date time k lye code
date time b ak he line ka code ha
font ka kam strt hogya
mainrichTextBox.SelectionFont = new Font(mainrichTextBox.Font, FontStyle.Bold);
font style k lye ha ye ak ak line ma ak chz ho rhe ha jsy ye bold ka code ha
method bnaya ha font ka
mainrichTextBox.SelectionFont = new Font(mainrichTextBox.SelectionFont, FontStyle.Underline);
mainrichTextBox.SelectionFont = new Font(mainrichTextBox.SelectionFont, FontStyle.Strikeout);
format font k lye code instance veriable ma ak r chz private kr k dalni pryge
ak event k lye b programmming krni ha ismy
FontDialog fontdialog = new FontDialog() {
};
fontdialog.ShowColor = true;
DialogResult result = fontdialog.ShowDialog(); ye dialogresult khudsy agr na likha jay to uper sy copy krlyn
MessageBox.Show("please select first");
text ka color change krny k lye code
ye dialogresult k lye mne uper sy dialogresult ko cupy kia hoa h
uper yni isi page ma uper sy na k khe r sy
messagetoolStripStatusLabel.Text = "New Click.. ";
messagetoolStripStatusLabel.Text = "Open Click.. ";
save file code method call
save file code Call Method
System.Diagnostics.Process.Start("https:allice9554.000webhostapp.com");
if(mainrichTextBox.SelectionLength >0)
mainrichTextBox.Cut();
mainrichTextBox.Paste();
mainrichTextBox.Cut();
mainrichTextBox.Paste();
mainrichTextBox.Cut();
mainrichTextBox.Paste();
this.Hide();
this.Hide();
if()
messagetoolStripStatusLabel.Text = " Start.. ";
this.Hide();
SecondCalculator.mainForm m = new SecondCalculator.mainForm();
m.ShowDialog();